#include "odbc/parameter.hpp"
#include <boost/test/auto_unit_test.hpp>

namespace
{

using namespace odbc;

/// \brief It tests the initialization when the value is done explicitly.
BOOST_AUTO_TEST_CASE( test_initialization_with_explicit_value)
{
#define ODBCTEST_CHECK_PARAMETER_INIT( TYPE, VALUE, DIRECTION) \
	{ \
		BOOST_CHECKPOINT( std::string( "Testing initialization of parameter of type [") + #TYPE + "] and direction [" + #DIRECTION + "]"); \
		TYPE v = VALUE; \
		parameter::e_direction direction = DIRECTION; \
		parameter p( v, direction); \
		BOOST_CHECK( v == boost::any_cast< TYPE>( p.value())); \
		BOOST_CHECK_EQUAL( direction, p.direction()); \
	}

#define ODBCTEST_CHECK_PARAM_INIT( TYPE, VALUE) \
	ODBCTEST_CHECK_PARAMETER_INIT( TYPE, VALUE, parameter::in); \
	ODBCTEST_CHECK_PARAMETER_INIT( TYPE, VALUE, parameter::out); \
	ODBCTEST_CHECK_PARAMETER_INIT( TYPE, VALUE, parameter::inout); 

	//ODBCTEST_CHECK_PARAM_INIT( int, -10);
	//ODBCTEST_CHECK_PARAM_INIT( unsigned int, 10);
	//ODBCTEST_CHECK_PARAM_INIT( char, -10);
	//ODBCTEST_CHECK_PARAM_INIT( unsigned char, 10);
	//ODBCTEST_CHECK_PARAM_INIT( wchar_t, L'A');
	//ODBCTEST_CHECK_PARAM_INIT( short, -10);
	//ODBCTEST_CHECK_PARAM_INIT( unsigned short, 10);
	//ODBCTEST_CHECK_PARAM_INIT( long, -10);
	//ODBCTEST_CHECK_PARAM_INIT( unsigned long, 10);
	//ODBCTEST_CHECK_PARAM_INIT( double, -10.5);
	//ODBCTEST_CHECK_PARAM_INIT( float, 10.5);
	//using namespace boost::gregorian;
	//ODBCTEST_CHECK_PARAM_INIT( date, date( 2008, 10, 5));
	//using namespace boost::posix_time;
	//ODBCTEST_CHECK_PARAM_INIT( ptime, ptime( date(2008, 10, 5), hours(10)+minutes(20)+seconds(30)));
	//ODBCTEST_CHECK_PARAM_INIT( std::string, std::string( "Test string"));
	//ODBCTEST_CHECK_PARAM_INIT( std::wstring, std::wstring( L"Test string"));

#undef ODBCTEST_CHECK_PARAM_INIT
#undef ODBCTEST_CHECK_PARAMETER_INIT
}

} // namespace